package com.example.service.webhook.business.security.repository;

import com.example.service.webhook.business.security.entity.InsuranceEntity;
import com.example.service.webhook.repository.base.BaseDAO;
import com.example.service.webhook.util.DateUtil;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * 公积金缴存信息
 * ClassName: EducationRepository    
 * date: 2016年7月26日 下午5:35:38   
 * @author yuandong  
 * @version   
 * @since JDK 1.6
 */
@Repository
public class InsuranceRepository extends BaseDAO<InsuranceEntity>{
	
	@Resource(name="templateSecurity")
    private JdbcTemplate jdbcTemplate;

    public JdbcTemplate getJdbcTemplate() {
		return jdbcTemplate;
	}
    
    public void saveInsuranceEntity(InsuranceEntity entity) throws Exception  {
    	entity.setCreateTime(DateUtil.getCurrentDate());
    	entity.setLastModifyTime(DateUtil.getCurrentDate());
		this.add(entity);
    }

    public void deleteInsuranceEntity(String userId,String userInfoId){
        String sql = "delete from t_insurance where userId=? and userInfoId=?";
        this.delete(sql, new Object[]{userId,userInfoId});
    }

}
